clear all
use "JBPA_Emotional_Labor_Open_Data.dta" 

logit paysat1 i.groups##c.prosocial i.muni, cluster(muni)

est sto mod1
su prosocial, de
local sd = r(sd)
local mean = r(mean)
local minus2 = `mean' - 2*`sd'
local minus1 = `mean' - 1*`sd'
local plus1 = `mean' + 1*`sd'
local plus2 = `mean' + 2*`sd'
margins groups, at(prosocial=(`minus2' `minus1' `mean' `plus1' `plus2')) post
est sto paysat_logit_marg
marginsplot, title("") ///
	plot1(m(circle) mc(black) mfc(white) lc(black)) ///
	plot2(m(circle) mc(gs9) mfc(gs9) lc(gs9)) ///
	ci1(lc(black)) ///
	ci2(lc(gs9)) recastci() ///
	ytitle("Likelihood of Pay Satisfaction", m(right)) ///
	xtitle("Prosociality", m(top)) ///	
	xlabel(`minus2' "very low" `minus1' "low" `mean' "Mean" `plus1' "high" `plus2' "very high") ///
	scheme(s2mono) ///
	legend(on order() ring(0) ///
				cols(1) region(c(none)) bplace(nw)) lev(70) ///
	name(mod1, replace) saving(mod1, replace)
	
	
logit futengage i.groups##c.prosocial i.muni, cluster(muni)

est sto mod2

local sd = r(sd)
local mean = r(mean)
local minus2 = `mean' - 2*`sd'
local minus1 = `mean' - 1*`sd'
local plus1 = `mean' + 1*`sd'
local plus2 = `mean' + 2*`sd'
margins groups, at(prosocial=(`minus2' `minus1' `mean' `plus1' `plus2')) post
est sto futengage_logit_marg
marginsplot, title("") ///
	plot1(m(circle) mc(black) mfc(white) lc(black)) ///
	plot2(m(circle) mc(gs9) mfc(gs9) lc(gs9)) ///
	ci1(lc(black)) ///
	ci2(lc(gs9)) recastci() ///
	ytitle("Willingness toward Future Engagement", m(right)) ///
	xtitle("Prosociality", m(top)) ///	
	xlabel(`minus2' "-2SD" `minus1' "-1SD" `mean' "Mean" `plus1' "+1SD" `plus2' "+2SD") ///
	scheme(s2mono) ///
	legend(on order() ring(0) ///
				cols(1) region(c(none)) bplace(nw)) lev(70) ///
	name(mod3, replace) saving(mod3, replace)

	
reg burnout1237 i.groups##c.prosocial i.muni, cluster(muni)

est sto mod3
su prosocial, de
local sd = r(sd)
local mean = r(mean)
local minus2 = `mean' - 2*`sd'
local minus1 = `mean' - 1*`sd'
local plus1 = `mean' + 1*`sd'
local plus2 = `mean' + 2*`sd'
margins groups, at(prosocial=(`minus2' `minus1' `mean' `plus1' `plus2')) post
est sto burnout1237_reg_marg
marginsplot, title("") ///
	plot1(m(circle) mc(black) mfc(white) lc(black)) ///
	plot2(m(circle) mc(gs9) mfc(gs9) lc(gs9)) ///
	ci1(lc(black)) ///
	ci2(lc(gs9)) recastci() ///
	ytitle("Emotional Burnout", m(right)) ///
	xtitle("Prosociality", m(top)) ///	
	xlabel(`minus2' "-2SD" `minus1' "-1SD" `mean' "Mean" `plus1' "+1SD" `plus2' "+2SD") ///
	scheme(s2mono) ///
	legend(on order() ring(0) ///
				cols(1) region(c(none)) bplace(nw)) lev(70) ///
	name(mod2, replace) saving(mod2, replace)


esttab mod1 mod3 mod2 using jbparesults, rtf replace title (Job Related Assessments) ar2 se b(%10.3f) drop (*muni*)

cibar futengage, over1(groups)
cibar paysat1, over1(groups)
cibar burnout1237, over1(groups)

